package com.sunwayhorizo.health.hl7.persistent;

import java.io.Serializable;

import java.sql.Timestamp;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

@Entity
@TableGenerator(name = "EntyIi_IdGenerator", table = "RIM_Id_Generator", pkColumnName = "pkColumn", valueColumnName = "valueColumn", pkColumnValue = "Enty_Ii")
@Table(name = "RIM_CORE_ENTY_II")
public class RimCoreEntyIi implements Serializable {
	/**
     * 
     */
    private static final long serialVersionUID = 1L;

    @Id
	@GeneratedValue(strategy = GenerationType.TABLE, generator = "EntyIi_IdGenerator")
	@Column(name = "ENTITY_II_ID", nullable = false)
	private Long entityIiId;
	
	@Column(name = "ROOT_ID", nullable = false)
	private String rootId;
	
	@Column(name = "EXTENSION_TXT")
	private String extensionTxt;
	
	@Column(name="IDENTIFIER_NAME")   
	private String identifierName; 
	
	public String getIdentifierName() {
		return identifierName;
	}

	public void setIdentifierName(String identifierName) {
		this.identifierName = identifierName;
	}

	/**
	 * 具有权威的唯一名称，如身份证编号等，不能重复。
	 * @author jinzw
	 * @date 2010-11-12
	 */
	@Column(name = "ASSIGNING_AUTHORITY_NAME")
	private String assigningAuthorityName;
	
	/**
	 * 具有权威的唯一名称来源 如发证单位等
	 * @author jinzw
	 * @date 2010-11-12
	 */
	@Column(name = "ID_SOUCE")
	private String assigningAuthorityNameSouce;
	
	/**
	 * 可显示的标志，例如证件状态等
	 * @author jinzw
	 * @date 2010-11-12
	 */
	@Column(name = "DISPLAYABLE_FLAG")
	private String displayableFlag;

	@Column(name = "CREATED_BY", nullable = false)
	private Long createdBy;
	
	@Column(name = "CREATION_DATE", nullable = false)
	private Timestamp creationDate;
	
	@Column(name = "LAST_UPDATED_BY", nullable = false)
	private Long lastUpdatedBy;
	
	@Column(name = "LAST_UPDATE_DATE", nullable = false)
	private Timestamp lastUpdateDate;
	
	@Column(name = "LAST_UPDATE_LOGIN")
	private Long lastUpdateLogin;
	
	/**
	 * 具有权威的唯一名称类型 例如身份证，军官证，护照等
	 * 与RimCoreEntyCdSets是单向一对一
	 * @author jinzw
	 * @date 2010-11-12
	 */
	@OneToOne(cascade=CascadeType.ALL)
	@JoinColumns({
			@JoinColumn(name = "ENTY_ID", referencedColumnName = "ENTITY_ID"),
			@JoinColumn(name = "ENTY_VERSION_NUM", referencedColumnName = "ENTITY_VERSION_NUM"),
			@JoinColumn(name = "ENTITY_CODE_SET_ID", referencedColumnName = "ENTITY_CODE_SET_ID")
			})
	private RimCoreEntyCdSets rimCoreEntyCdSets;

	@ManyToOne
	@JoinColumns({
			@JoinColumn(name = "ENTITY_ID", referencedColumnName = "ENTITY_ID"),
			@JoinColumn(name = "ENTITY_VERSION_NUM", referencedColumnName = "ENTITY_VERSION_NUM") })
	private RimCoreEntities rimCoreEntities;

	// @ManyToOne
	// @JoinColumn(name = "ROOT_ID") private RimCoreRootMaster
	// rimCoreRootMaster;

	public RimCoreEntyIi() {
	}

	public String getAssigningAuthorityName() {
		return assigningAuthorityName;
	}

	public void setAssigningAuthorityName(String assigningAuthorityName) {
		this.assigningAuthorityName = assigningAuthorityName;
	}

	public Long getCreatedBy() {
		return createdBy;
	}

	public void setCreatedBy(Long createdBy) {
		this.createdBy = createdBy;
	}

	public Timestamp getCreationDate() {
		return creationDate;
	}

	public void setCreationDate(Timestamp creationDate) {
		this.creationDate = creationDate;
	}

	public String getDisplayableFlag() {
		return displayableFlag;
	}

	public void setDisplayableFlag(String displayableFlag) {
		this.displayableFlag = displayableFlag;
	}

	public Long getEntityIiId() {
		return entityIiId;
	}

	public void setEntityIiId(Long entityIiId) {
		this.entityIiId = entityIiId;
	}

	public String getExtensionTxt() {
		return extensionTxt;
	}

	public void setExtensionTxt(String extensionTxt) {
		this.extensionTxt = extensionTxt;
	}

	public Long getLastUpdatedBy() {
		return lastUpdatedBy;
	}

	public void setLastUpdatedBy(Long lastUpdatedBy) {
		this.lastUpdatedBy = lastUpdatedBy;
	}

	public Timestamp getLastUpdateDate() {
		return lastUpdateDate;
	}

	public void setLastUpdateDate(Timestamp lastUpdateDate) {
		this.lastUpdateDate = lastUpdateDate;
	}

	public Long getLastUpdateLogin() {
		return lastUpdateLogin;
	}

	public void setLastUpdateLogin(Long lastUpdateLogin) {
		this.lastUpdateLogin = lastUpdateLogin;
	}

	public void setRimCoreEntities(RimCoreEntities rimCoreEntities) {
		this.rimCoreEntities = rimCoreEntities;
	}

	public RimCoreEntities getRimCoreEntities() {
		return rimCoreEntities;
	}

	/*
	 * public void setRimCoreRootMaster(RimCoreRootMaster rimCoreRootMaster) {
	 * this.rimCoreRootMaster = rimCoreRootMaster; }
	 * 
	 * public RimCoreRootMaster getRimCoreRootMaster() { return
	 * rimCoreRootMaster; }
	 */

	public void setRootId(String rootId) {
		this.rootId = rootId;
	}

	public String getRootId() {
		return rootId;
	}
	

	public String getAssigningAuthorityNameSouce() {
		return assigningAuthorityNameSouce;
	}

	public void setAssigningAuthorityNameSouce(String assigningAuthorityNameSouce) {
		this.assigningAuthorityNameSouce = assigningAuthorityNameSouce;
	}
	
	public RimCoreEntyCdSets getRimCoreEntyCdSets() {
		return rimCoreEntyCdSets;
	}

	public void setRimCoreEntyCdSets(RimCoreEntyCdSets rimCoreEntyCdSets) {
		this.rimCoreEntyCdSets = rimCoreEntyCdSets;
	}

}
